﻿using AntdUI;

namespace WenAntdUI.License
{
    public partial class FormLicense : WenForm
    {
        public FormLicense()
        {
            InitializeComponent();

            this.textBox2.Text = LicenseManager.GetHardwareId();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            var result = LicenseManager.ValidateLicense(textBox1.Text);
            if (result)
            {
                MessageBox.Show("感谢您对我们支持，我们会继续努力，做更好的软件。\r\n\r\n点击确定后重新运行程序", "验证成功！");
                File.WriteAllText("license.key", textBox1.Text);
                Application.Exit();
            }
            else
            {
                MessageBox.Show("您输入的注册码并没有验证通过，请仔细核对", "验证失败！");
            }
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            this.ClipboardSetText(textBox2.Text);
        }

        #region 公有属性
        [Description("左侧图片位置图案")]
        [Category("外观")]
        public Image Image { get => pictureBox1.Image; set { if (value != null) pictureBox1.Image = value; } }

        [Description("左侧提示文字信息")]
        [Category("外观")]
        public string? Description { get => label1.Text; set => label1.Text = value; }

        [Description("左侧第二行提示文字信息")]
        [Category("外观")]
        public string? DescriptionSub { get => label2.Text; set => label2.Text = value; }
        #endregion
    }
}
